﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.ComponentModel;


namespace Warhammer40K_Simulator.model
{
    public class element : INotifyPropertyChanged
    {

        public element clone()
        {
            element e = new element();
            e.label = label;
            e.count = count;

            foreach (element ce in children)
            {
                e.children.Add(ce.clone());
            }

            return e;
        }


        public event PropertyChangedEventHandler PropertyChanged;
        protected void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }

        private String label;
        public String Label
        {
            get
            {
                return label;
            }
            set
            {
                label = value;
                NotifyPropertyChanged("Label");
            }
        }

        private int count;
        public int Count
        {
            get
            {
                return count;
            }
            set
            {
                count = value;
                NotifyPropertyChanged("Count");
            }
        }

        private ObservableCollection<element> children = new ObservableCollection<element>();
        public ObservableCollection<element> Children
        {
            get
            {
                return children;
            }
            set
            {
                children = value;
                NotifyPropertyChanged("Children");
            }
        }


    }
}
